subroutine read_xsec(nxec,e,sig)
  use param
  use fptr
  implicit none
  integer,intent(in) :: nxec
  real(dbl),intent(in) :: e
  real(dbl),intent(out) :: sig
  integer :: i
  real(dbl) :: e1,e2,r1,r2
  do i=xptr,lenx,2
     read(nxec,rec=i) e1
     read(nxec,rec=i+1) r1
     if (e.le.e1) then
        if (xptr.gt.4) then
           read(nxec,rec=i-2) e2
           read(nxec,rec=i-1) r2
           xptr=i
           sig=r2+(r2-r1)*(e-e1)/(e2-e1)
           return
        else
           sig=0
           return
        end if
     end if
  end do
  write(*,'(3x,"Err-read_xec-Energ=",1pe9.3,1x,"is out of range.")') e
  write(*,'(3x,"E1=",1pe9.3,1x,"E2=",1pe9.3)') e1,e2
  stop
end subroutine read_xsec
